<?php

namespace App\Kuafu\Audit\Service;

use App\Kuafu\Audit\Enum\AuditEventCodeEnum;
use App\Kuafu\Base\Service\BaseService;
use App\Library\FeiShu\SendFs;

class AuditService extends BaseService
{
    public static function getInstance(): SendFs
    {
        return SendFs::newRobot(SendFs::ROBOT_AUDIT);
    }

    public static function getTypeText($type): string
    {
        return AuditEventCodeEnum::EVENT_TYPE_TEXT[$type] ?? '';
    }

    public static function sendNotify($type, $content)
    {
        $title = self::getTypeText($type);

        $parentContent = [
            'time' => date('Y-m-d H:i:s', time())
        ];

        self::getInstance()->setTitleContent($title, $content)
            ->send();
    }

}
